package suanfa;

import java.util.LinkedList;
import java.util.Queue;
import java.util.Stack;

/**
 * Description:
 * Author:    Dane
 * CreateTime:2024/8/26-下午3:16
 * Since  :   1.0
 * Version:   1.0
 */
public class hanoiTower {
    private static int count;
   public static void hannuo(int n,char a,char b,char c){
       count++;
       if (n==1){
           System.out.println("第1个盘子:" + a + "-->" + c);
       }else {
           hannuo(n-1,a,c,b);
           System.out.println("第" + n + "个盘子:" + a + "-->" + c);
           hannuo(n-1,b,a,c);
       }


   }

    public static void main(String[] args) {
     hannuo(3,'a','b','c');
        System.out.println("一共"+count+"步");
    }
}
